import request from '@/utils/request'
/**@description 查询选中的单词表 */
export function listWord(name) {
  return request({
    url: `/system/word/getWord?name=${name}`,
    method: 'get',
  })
}

/**@description 查询所有的选项 */
export function getOptions() {
  return request({
    url: '/system/word/getOptions',
    method: 'get',
  })
}

/**@description 查询表格详细 */
export function getTable(name) {
  return request({
    url: `/system/table/find?name=${name}`,
    method: 'get'
  })
}

/**@description 更新front_account */
export function updateWord(name,word) {
  return request({
    url: '/system/word/updateWord',
    method: 'post',
    data: {
      name:name,
      word: word
    }
  })
}
/**@description 新增front_account */
export function addWord(name, newone) {
  return request({
    url: '/system/word/addWord',
    method: 'post',
    data: {
      name: name,
      newone: newone
    }
  })
}

/**@description 删除front_account */
export function delWord(name,id) {
  return request({
    url: '/system/word/delWord',
    method: 'post',
    data: {
      name: name,
      id:id
    }
  })
}

/**@description 查找单词 */
export function findWord(name,id) {
  return request({
    url: '/system/word/find',
    method: 'post',
    data: {
      name: name,
      id:id
    }
  })
}


export function elementInclude(array, element) {

  const flag = false
  if (array == []) {
    array.forEach(e => {
      if (e.eng = element.eng) {
        flag = true
      }
    });
  }

  return flag
}